package org.dtrd.modules.flup.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.dtrd.modules.flup.entity.bean.FlupFlowItem;
import org.dtrd.modules.flup.entity.po.DtrdEntRdFlupAppointmentRecord;

import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 复诊预约记录 Mapper 接口
 * </p>
 *
 * @author QR
 * @since 2021-12-16
 */
@Mapper
public interface DtrdEntRdFlupAppointmentRecordMapper extends BaseMapper<DtrdEntRdFlupAppointmentRecord> {

    /**
     * 获取指定范围内的预约人数
     * @param doctorId doctorId
     * @param startDate 开始时间
     * @param endDate 结束时间
     * @return 预约人数
     */
    int selectPatientByDateRange(@Param("doctorId") Integer doctorId,
                                 @Param("startDate") Date startDate,
                                 @Param("endDate") Date endDate);

    /**
     * 根据 复诊模版id 查询复诊流程
     * @param templateId 复诊模版id
     * @param flupId 复诊记录id
     */
    List<FlupFlowItem> selectFlupFlow(@Param("templateId") Integer templateId,
                                      @Param("flupId") Integer flupId);

    void removeRecordByPatientIds(@Param("patientIdList") Set<Integer> patientIds,@Param("statusArray") int... flupStatus);
}
